import request from '@/utils/request'

// 获取任务列表
export function pagingPromotion(query) {
  return request({
    url: '/sell/promotion/pagingPromotion',
    method: 'get',
    params: query
  })
}

/**
 * 更新结束状态
 */
export function updatePromotionStop(query) {
  return request({
    url: '/sell/promotion/updatePromotionStop',
    method: 'get',
    params: query
  })
}

/**
 * 分销商品
 * @param query
 */
export function pagingPromotionGoods(query) {
  return request({
    url: '/sell/promotion/pagingPromotionGoods',
    method: 'get',
    params: query
  })
}

/**
 * 保存
 * @param data
 */
export function savePromotion(data) {
  return request({
    url: '/sell/promotion/save',
    method: 'post',
    data: data
  })
}

export function getPromotionInfo(query) {
  return request({
    url: '/sell/promotion/getPromotionInfo',
    method: 'get',
    params: query
  })
}

/**
 * 删除活动
 */
export function deletePromotion(query) {
  return request({
    url: '/sell/promotion/delete',
    method: 'get',
    params: query
  })
}

/**
 * 更新活动状态为进行中
 * @param data
 */
export function updatePromotionStatus(data) {
  return request({
    url: '/sell/promotion/updatePromotionStatus',
    method: 'post',
    data: data
  })
}

export function updatePromoitonRemark(data) {
  return request({
    url: '/sell/promotion/updatePromoitonRemark',
    method: 'get',
    params: data
  })
}

/**
 * 发布活动
 */
export function updatePromoitonRelease(promotionId) {
  return request({
    url: '/sell/promotion/updatePromoitonRelease',
    method: 'get',
    params: {
      promotionId
    }
  })
}

/**
 * 获取活动信息
 */
export function countPromotionOrder(promotionId) {
  return request({
    url: '/sell/promotion/countPromotionOrder',
    method: 'get',
    params: {
      promotionId
    }
  })
}

/**
 * 获取活动信息
 */
export function getPromotion(promotionId) {
  return request({
    url: '/sell/promotion/get',
    method: 'get',
    params: {
      promotionId
    }
  })
}

/**
 * 检查活动商品信息
 */
export function checkPromotionGoods(data) {
  return request({
    url: '/sell/promotion/checkPromotionGoods',
    method: 'post',
    data: data
  })
}

/**
 * 后台下拉框可选择筛选活动数据
 */
export function getPromotionForSelControlList(params) {
  return request({
    url: '/sell/promotion/getPromotionForSelControlList',
    method: 'get',
    params: params
  })
}

/**
 *  获取团长业绩排名数据
 */
export function statisticsGroupBuyAchievement(params) {
  return request({
    url: '/sell/promotion/statisticsGroupBuyAchievement',
    method: 'get',
    params: params
  })
}

export function updatePromotionGoodsSortNo(data) {
  return request({
    url: '/sell/promotion/updatePromotionGoodsSortNo',
    method: 'post',
    data: data
  })
}

export function updatePromotionPreSaleStock(data) {
  return request({
    url: '/sell/promotion/updatePromotionPreSaleStock',
    method: 'post',
    data: data
  })
}

/**
 * 获取活动信息
 */
export function getGroupPromotion(promotionId, detailsId) {
  return request({
    url: '/sell/promotion/getGroupPromotion',
    method: 'get',
    params: {
      promotionId, detailsId
    }
  })
}
